package cn.com.cis.persistence;

import cn.com.cis.domain.Role;
import cn.com.cis.domain.User;

import java.util.List;

public interface UserMapper {

  User selectUserById(int id);

  User selectUserByUsernameAndPassword(String username, String password);
  
  User selectUserByUsername(String username);

  void insertUser(User user);

  void deleteUser(int id);

  void updateUser(User user);

  List<User> selectAllUser();
  
  List<Role> selectUserRoles(int userId);
  
  List<String> selectPermissionsForUser(int userId);

  void addPermissionForUser(int userId, String code);

  void deletePermissionFromUser(Integer userId, String code);

  void clearRoles(int id);

  void addRole(int id, String roleId);

  void clearPermissions(int id);

  void updateUserAndPassword(User user);
}
